\ toolkit 99.2.12 NAB

needs core-ext

decimal

: place ( a1 n1 a2 -- )
\ Place a1 n1 as counted string at a2:
  2dup 2>r  char+ swap  move  2r> c! ;

: place, ( a1 n1 -- )
  here  over 1+ chars allot  place ;

: bounds ( a n -- a+n a )
\ Compute loop bounds for a string:
  chars over + swap ;

: >lower ( C -- c )
  dup [char] A [char] Z 1+ within
  if  32 or  then ;
: >upper ( c -- C )
  dup [char] a [char] z 1+ within
  if  223 and  then ;

: append ( at ut as us -- at ut+us )
\ Append string s to the end of t:
  dup >r  2over +  swap move  r> + ;

: array ( cells <name> -- )
  create  cells allot
  does> swap cells + ;

: under+ ( n1 x1 n2 -- n1+n2 x1 )
  rot + swap ;

: enum ( n -- )  create ,
  does> ( -- n )
  dup  @ constant  1 swap +! ;

: [end]  begin refill 0= until ;

: [defined]  bl word find nip 0<> ;

: 0allot ( chars -- )
  here over allot  swap 0 fill ;

: 3drop 2drop drop ;
: 4drop 2drop 2drop ;
: 6drop 3drop 3drop ;

: string:
  :noname
  >in @ >r  parse-word 2drop
  >in @  char  swap  1+ >in !
  parse  postpone sliteral
  postpone ;  execute
  r> >in ! 2constant  postpone \ ;
